//
//  ORAccountHeadImage.m
//  NewsWith
//
//  Created by rimi on 2016/12/14.
//  Copyright © 2016年 dongfumei. All rights reserved.
//

#import "ORAccountHeadImage.h"

@implementation ORAccountHeadImage

+ (void)accountHeadImageWithHeadImage:(UIImage *)headImage Block:(AVOSCloudBlock)block{
    
    AVUser *user = [AVUser user];
    
    if (headImage) {
        //图片转化成数据流
        NSData *data = UIImageJPEGRepresentation(headImage, 0.5);
        AVFile *file = [AVFile fileWithName:@"image.jpg" data:data];
        [file save];
        [user setObject:file forKey:@"headImage"];
        [user saveInBackground];
        [user signUpInBackgroundWithBlock:^(BOOL succeeded, NSError * _Nullable error) {
            if (block) {
                block(succeeded,error);
            }
        }];
    }
    
}

@end
